name: tpu_app

# The working directory contains all code and will be synced to remote.
workdir: ./examples/tpu/tpu_app_code

resources:
  accelerators: tpu-v2-8
  accelerator_args:
    runtime_version: 2.12.0
    tpu_vm: False

# The setup command.  Will be run under the working directory.
setup: |
  pip install --upgrade pip

  conda activate huggingface
  if [ $? -eq 0 ]; then
    echo 'conda env exists'
  else
    conda create -n huggingface python=3.8 -y
    conda activate huggingface
    pip install -r requirements.txt
  fi

# The command to run.  Will be run under the working directory.
run: |
  conda activate huggingface
  python -u run_tpu.py
